<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>ButtonAPI</title>
    <link rel="stylesheet" href="../css/bootstrap.min.css">
    <link rel="stylesheet" href="../css/bootstrapEx.css">
    <link rel="stylesheet" href="../js/prettyPrint/css/prettify.css">
    <link rel="stylesheet" href="api.css">


    <script src="../js/jquery-1.9.1.min.js"></script>
    <script type="text/javascript" src="../js/bootstrap.min.js"></script>
    <script type="text/javascript" src="../js/prettyPrint/js/prettify.js"></script>
</head>

<body onload="prettyPrint()">
    <div class="container-fluid">
        <div class="">
            <div class="span12">
                <h1>属性</h1>
                <hr/>
            </div>
            <div class="">
                <h3>bsEx.Button </h3>
                添加引用
                <pre class="prettyprint linenums"><code> &lt;link rel=&quot;stylesheet&quot; href=&quot;../../css/bootstrap.min.css&quot;&gt;
 &lt;link rel=&quot;stylesheet&quot; href=&quot;../../css/bootstrapEx.css&quot;&gt;
 
 &lt;script src=&quot;../../js/jquery-1.9.1.min.js&quot;&gt;&lt;/script&gt;
 &lt;script type=&quot;text/javascript&quot; src=&quot;../../js/bootstrap.min.js&quot;&gt;&lt;/script&gt;
 &lt;script type=&quot;text/javascript&quot; src=&quot;../../js/bootstrapEx2.0.js&quot;&gt;&lt;/script&gt;</code></pre>
                <p>继承自bsEx.ui.base:</p>
                <div class="table">
                    <div class="row title">
                        <div class="col-xs-2 col-sm-2">属性名称</div>
                        <div class="col-xs-2 col-sm-2">类型</div>
                        <div class="col-xs-3 col-sm-3">默认值</div>
                        <div class="col-xs-5 col-sm-5">备注说明</div>
                    </div>
                    <div class="row">
                        <div class="col-xs-2 col-sm-2">id</div>
                        <div class="col-xs-2 col-sm-2">string</div>
                        <div class="col-xs-3 col-sm-3">bsEx.getId()</div>
                        <div class="col-xs-5 col-sm-5">控件ID</div>
                    </div>
                    <div class="row">
                        <div class="col-xs-2 col-sm-2">renderto</div>
                        <div class="col-xs-2 col-sm-2">string</div>
                        <div class="col-xs-3 col-sm-3">无(必填)</div>
                        <div class="col-xs-5 col-sm-5">绘制到容器的对象或选择器</div>
                    </div>
                    <div class="row">
                        <div class="col-xs-2 col-sm-2">type</div>
                        <div class="col-xs-2 col-sm-2">string</div>
                        <div class="col-xs-3 col-sm-3">Button</div>
                        <div class="col-xs-5 col-sm-5">控件类型</div>
                    </div>
                    <div class="row">
                        <div class="col-xs-2 col-sm-2">firstInit</div>
                        <div class="col-xs-2 col-sm-2">boolean</div>
                        <div class="col-xs-3 col-sm-3">false</div>
                        <div class="col-xs-5 col-sm-5">第一次加载是否完成</div>
                    </div>
                    <div class="row">
                        <div class="col-xs-2 col-sm-2">language</div>
                        <div class="col-xs-2 col-sm-2">bsEx.language</div>
                        <div class="col-xs-3 col-sm-3">bsEx.language.zhCN</div>
                        <div class="col-xs-5 col-sm-5">当前语言包</div>
                    </div>
                    <div class="row">
                        <div class="col-xs-3 col-sm-3">cls</div>
                        <div class="col-xs-3 col-sm-3">string</div>
                        <div class="col-xs-3 col-sm-3">""</div>
                        <div class="col-xs-3 col-sm-3">自定义样式 在绘制之前会在renderto加入该样式</div>
                    </div>
                </div>
                <p>控件实例属性:</p>
                <div class="table">
                    <div class="row title">
                        <div class="col-xs-2 col-sm-2">属性名称</div>
                        <div class="col-xs-2 col-sm-2">类型</div>
                        <div class="col-xs-3 col-sm-3">默认值</div>
                        <div class="col-xs-5 col-sm-5">备注说明</div>
                    </div>
                    <div class="row">
                        <div class="col-xs-2 col-sm-2">btntype</div>
                        <div class="col-xs-2 col-sm-2">string|number</div>
                        <div class="col-xs-3 col-sm-3">default</div>
                        <div class="col-xs-5 col-sm-5">按钮样式 ["default","primary","success","info","warning","danger","link"]<br>可直接传名称或从0开始的编号</div>
                    </div>
                    <div class="row">
                        <div class="col-xs-2 col-sm-2">sizetype</div>
                        <div class="col-xs-2 col-sm-2">boolean</div>
                        <div class="col-xs-3 col-sm-3">false</div>
                        <div class="col-xs-5 col-sm-5">按钮大小 ["lg","sm","xs"]<br>默认为正常显示，可以直接传名称或从0开始的编号</div>
                    </div>
                    <div class="row">
                        <div class="col-xs-2 col-sm-2">isblock</div>
                        <div class="col-xs-2 col-sm-2">boolean</div>
                        <div class="col-xs-3 col-sm-3">false</div>
                        <div class="col-xs-5 col-sm-5">block样式</div>
                    </div>
                    <div class="row">
                        <div class="col-xs-2 col-sm-2">isactive</div>
                        <div class="col-xs-2 col-sm-2">boolean</div>
                        <div class="col-xs-3 col-sm-3">false</div>
                        <div class="col-xs-5 col-sm-5">是否激活</div>
                    </div>
                    <div class="row">
                        <div class="col-xs-2 col-sm-2">isdisabled</div>
                        <div class="col-xs-2 col-sm-2">boolean</div>
                        <div class="col-xs-3 col-sm-3">false</div>
                        <div class="col-xs-5 col-sm-5">是否禁用</div>
                    </div>
                    <div class="row">
                        <div class="col-xs-2 col-sm-2">text</div>
                        <div class="col-xs-2 col-sm-2">string</div>
                        <div class="col-xs-3 col-sm-3">bsEx.delanguage().Button.text()|按钮</div>
                        <div class="col-xs-5 col-sm-5">默认的按钮名称，当该值为false则显示元素原始html</div>
                    </div>
                </div>
                <h4>示例</h4>
                <pre class="prettyprint linenums"><code> new bsEx.Button({
    renderto:"#btn3",
    text:"小按钮",//text内容会append标签中
    btntype:4,//可以通过字典选择按钮类型 从0开始
    sizetype:"sm"//按钮大小
 });</code> </pre>
                <hr/>
            </div>
        </div>
        <div class="">
            <div class="span12">
                <h1>方法</h1>
                <hr/>
            </div>
            <div class="">
                <h3>init() <small>返回类型: 无</small></h3>
                <p>绘制方法 new bsEx.Button(object); 会自动绘制</p>
                <h4>示例</h4>
                <pre class="prettyprint linenums"><code>略</code> </pre>
                <hr/>
            </div>
            <div class="">
                <h3>button() <small>返回类型: bootstrap原生button对象方法</small></h3>
                <p>bootstrap原生button对象方法</p>
                <h4>示例</h4>
                <pre class="prettyprint linenums"><code>btn1.button('loading')</code> </pre>
                <hr/>
            </div>
            <div class="">
                <h3>loading(txt) <small>返回类型: bootstrap原生button对象方法</small></h3>
                <p>按钮加载样式，将XX.button('loading');单独提出，txt为加载文字。默认为t.loadingtxt</p>
                <h4>示例</h4>
                <pre class="prettyprint linenums"><code>btn1.loading();</code> </pre>
                <hr/>
            </div>
            <div class="">
                <h3>reset() <small>返回类型: bootstrap原生button对象方法</small></h3>
                <p>按钮重置，将XX.button('reset');单独提出</p>
                <h4>示例</h4>
                <pre class="prettyprint linenums"><code>btn1.reset()</code> </pre>
                <hr/>
            </div>
            <div class="">
                <h3>settext(val) <small>返回类型: 当前按钮实例</small></h3>
                <p>设置显示文本，XX.txt(val)</p>
                <h4>示例</h4>
                <pre class="prettyprint linenums"><code>略</code> </pre>
                <hr/>
            </div>
            <div class="">
                <h3>setdisabled(b) <small>返回类型: 无</small></h3>
                <p>是否禁用</p>
               <h4>示例</h4>
               <pre class="prettyprint linenums"><code>略</code> </pre>
               <hr/>
            </div>
            <div class="">
                <h3>setactive(b) <small>返回类型: 无</small></h3>
                <p>是否激活/按下状态</p>
               <h4>示例</h4>
               <pre class="prettyprint linenums"><code>略</code> </pre>
               <hr/>
            </div>
        </div>
        <div class="">
            <div class="span12">
                <h1>事件</h1>
                <hr/>
            </div>
            <div class="">
                <h3>beforeinit(t) <small>返回类型: 无</small></h3>
                <p>绘制前事件，执行init()后第一个执行，可以对实例进行操作影响init执行</p>
                <div class="table">
                    <div class="row title">
                        <div class="col-xs-3 col-sm-3">参数名称</div>
                        <div class="col-xs-3 col-sm-3">类型</div>
                        <div class="col-xs-3 col-sm-3">默认值</div>
                        <div class="col-xs-3 col-sm-3">备注说明</div>
                    </div>
                    <div class="row">
                        <div class="col-xs-3 col-sm-3">t</div>
                        <div class="col-xs-3 col-sm-3">object</div>
                        <div class="col-xs-3 col-sm-3">无</div>
                        <div class="col-xs-3 col-sm-3">控件实例</div>
                    </div>
                </div>
                <h4>示例</h4>
                <pre class="prettyprint linenums"><code>略</code> </pre>
                <hr/>
            </div>
            <div class="">
                <h3>inited(t) <small>返回类型: 无</small></h3>
                <p>绘制后事件，执行init()后执行</p>
                <div class="table">
                    <div class="row title">
                        <div class="col-xs-3 col-sm-3">参数名称</div>
                        <div class="col-xs-3 col-sm-3">类型</div>
                        <div class="col-xs-3 col-sm-3">默认值</div>
                        <div class="col-xs-3 col-sm-3">备注说明</div>
                    </div>
                    <div class="row">
                        <div class="col-xs-3 col-sm-3">t</div>
                        <div class="col-xs-3 col-sm-3">object</div>
                        <div class="col-xs-3 col-sm-3">无</div>
                        <div class="col-xs-3 col-sm-3">控件实例</div>
                    </div>
                </div>
                <h4>示例</h4>
                <pre class="prettyprint linenums"><code>略</code> </pre>
                <hr/>
            </div>
            <div class="">
                <h3>click(t) <small>返回类型: 无</small></h3>
                <p>点击事件</p>
                <div class="table">
                    <div class="row title">
                        <div class="col-xs-3 col-sm-3">参数名称</div>
                        <div class="col-xs-3 col-sm-3">类型</div>
                        <div class="col-xs-3 col-sm-3">默认值</div>
                        <div class="col-xs-3 col-sm-3">备注说明</div>
                    </div>
                    <div class="row">
                        <div class="col-xs-3 col-sm-3">t</div>
                        <div class="col-xs-3 col-sm-3">object</div>
                        <div class="col-xs-3 col-sm-3">无</div>
                        <div class="col-xs-3 col-sm-3">控件实例</div>
                    </div>
                </div>
                <h4>示例</h4>
                <pre class="prettyprint linenums"><code> btn1.on("click",function(t){});</code> </pre>
                <hr/>
            </div>
            <div class="">
                <h3>click(t,contorl) <small>返回类型: 无</small></h3>
                <p>点击事件</p>
                <div class="table">
                    <div class="row title">
                        <div class="col-xs-3 col-sm-3">参数名称</div>
                        <div class="col-xs-3 col-sm-3">类型</div>
                        <div class="col-xs-3 col-sm-3">默认值</div>
                        <div class="col-xs-3 col-sm-3">备注说明</div>
                    </div>
                    <div class="row">
                        <div class="col-xs-3 col-sm-3">t</div>
                        <div class="col-xs-3 col-sm-3">object</div>
                        <div class="col-xs-3 col-sm-3">无</div>
                        <div class="col-xs-3 col-sm-3">控件实例</div>
                    </div>
                    <div class="row">
                        <div class="col-xs-3 col-sm-3">contorl</div>
                        <div class="col-xs-3 col-sm-3">object</div>
                        <div class="col-xs-3 col-sm-3">无</div>
                        <div class="col-xs-3 col-sm-3">外层控件实例，比如作为Panel的btns出现，此参数就代表Panel</div>
                    </div>
                </div>
                <h4>示例</h4>
                <pre class="prettyprint linenums"><code>$(document).ready(function () {
    new bsEx.Panel({
        renderto:"#panel2",
        title:"带按钮面板",
        body: '普通面板高度随内容增加,这个面板底部有按钮,',
        btns:[{id:"btn_save",text:"保存",btntype:"primary"},{id:"btn_close",text:"取消"}]
    });
});
//注意参数，按钮作为Panel的btns出现，第二个参数表示Panel实例，t按钮实例，pPanel实例
function btn_save_onclick(t,p){
    bsEx.Alert("提示",p.title + ":" + t.text,2)
}
</code> </pre>
                <hr/>
            </div>
        </div>
</body>
<script>
      $(document).ready(function () {
          $.each($(".table").find(".row div"),function(i,t){
              $(t).removeClass("col-xs-3 col-sm-3");
          });
          $.each($(".table").find(".row"),function(i,t){
              $(t).find("div").eq(0).addClass("col-xs-2 col-sm-2");
              $(t).find("div").eq(1).addClass("col-xs-2 col-sm-2");
              $(t).find("div").eq(2).addClass("col-xs-3 col-sm-3");
              $(t).find("div").eq(3).addClass("col-xs-5 col-sm-5");
          });
      });
</script>
</html>